package com.lemon.controller.accountControl.comm;


/**
 * @类功能说明：结果返回类
 */
public class ResponseResult {
    /**
     * 返回码
     */
    private int code = ResponseCode.SUCCESS.getCode();
    /**
     * 返回信息错误描述
     */
    private String messages = ResponseCode.SUCCESS.getDesc();
    /**
     * 返回对象
     */
    private Object data;

    public ResponseResult() {
    }

    public ResponseResult(ResponseCode rspCode) {
        this.code = rspCode.getCode();
        this.messages = rspCode.getDesc();
    }
    
    public static  ResponseResult ok(Object o){
    	
    	return new ResponseResult(ResponseCode.SUCCESS,o);
    }
    
    public static  ResponseResult error(String msg){
    	
    	return new ResponseResult(1,msg);
    }

    public ResponseResult(ResponseCode rspCode, Object data) {
        this.code = rspCode.getCode();
        this.messages = rspCode.getDesc();
        this.data = data;
    }

    public ResponseResult(int code, String message) {
        this.code = code;
        this.messages = message;
    }

    public ResponseResult(int code, String messages, Object data) {
        this.code = code;
        this.messages = messages;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }


    public String getMessages() {
        return messages;
    }

    public void setMessages(String messages) {
        this.messages = messages;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
